<template>
  <el-drawer
    v-model="drawerVisible"
    :size="650"
    :title="title"
    @closed="$emit('closed')"
    append-to-body
  >
    <el-container v-loading="saveLoading">
      <el-main>
        <el-form :model="form" ref="saveForm" label-width="140px">
          <el-form-item label="企业名称" prop="name">
            {{ form.name }}
          </el-form-item>

          <el-form-item label="企业类型" prop="enterpriseType">
            {{ form.enterpriseType }}
          </el-form-item>

          <el-form-item label="企业属地" prop="block">
            {{ form.block }}
          </el-form-item>

          <el-form-item label="法定代表人" prop="legalPerson">
            {{ form.legalPerson }}
          </el-form-item>

          <el-form-item label="统一社会信用代码" prop="unifiedCode">
            {{ form.unifiedCode }}
          </el-form-item>

          <el-form-item label="注册资本" prop="regCapital">
            {{ form.regCapital }} 万元
          </el-form-item>

          <el-form-item label="注册地址" prop="address">
            {{ form.address }}
          </el-form-item>

          <el-form-item label="联系电话" prop="contactNumber">
            {{ form.contactNumber }}
          </el-form-item>

          <el-form-item label="注册日期" prop="regDate">
            {{ form.regDate }}
          </el-form-item>

          <el-form-item label="所属行业" prop="industry">
            {{ form.industry }}
          </el-form-item>

          <el-form-item label="缴纳社保信息" prop="insrcInfo">
            {{ form.insrcInfo }}
          </el-form-item>

          <el-form-item label="缴纳人数" prop="personCount">
            {{ form.personCount }}
          </el-form-item>
        </el-form>
      </el-main>
      <el-footer>
        <div class="form-footer">
          <el-button type="primary" @click="close">关闭</el-button>
        </div>
      </el-footer>
    </el-container>
  </el-drawer>
</template>

<script>
export default {
  name: "enterprise-details",
  data() {
    return {
      saveLoading: false,
      drawerVisible: false,
      title: "企业详情",
      form: {},
    };
  },
  watch: {},
  mounted() {},
  methods: {
    //获取详细数据
    async open(id) {
      this.drawerVisible = true;
      this.saveLoading = true;
      let params = { id: id };
      let res = await this.$API.enterprise.details.get(params);
      if (res.code == 0) {
        this.form = res.data;
        this.saveLoading = false;
      } else {
        let errdata = this.$TOOL.response(res);
        this.$alert(
          this.$TOOL.json.get("", errdata, "message"),
          this.$TOOL.json.get("", errdata, "title"),
          {
            type: "error",
            confirmButtonText: "确定",
            dangerouslyUseHTMLString: true,
            showCancelButton: false,
          }
        )
          .then(() => {
            this.drawerVisible = false;
          })
          .catch(() => {});
      }
    },
    // 关闭页面
    close() {
      this.drawerVisible = false;
    },
  },
};
</script>

<style></style>
